package cn.iocoder.yudao.module.security.dal.mysql.rule;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.security.dal.dataobject.rule.SecurityRuleDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.security.controller.admin.rule.vo.*;

/**
 * 规则 Mapper
 *
 * @author 超管
 */
@Mapper
public interface SecurityRuleMapper extends BaseMapperX<SecurityRuleDO> {

    default PageResult<SecurityRuleDO> selectPage(SecurityRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SecurityRuleDO>()
                .eqIfPresent(SecurityRuleDO::getSId, reqVO.getSId())
                .eqIfPresent(SecurityRuleDO::getGId, reqVO.getGId())
                .likeIfPresent(SecurityRuleDO::getMsg, reqVO.getMsg())
                .eqIfPresent(SecurityRuleDO::getContent, reqVO.getContent())
                .eqIfPresent(SecurityRuleDO::getFile, reqVO.getFile())
                .eqIfPresent(SecurityRuleDO::getRuleType, reqVO.getRuleType())
                .eqIfPresent(SecurityRuleDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SecurityRuleDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(SecurityRuleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SecurityRuleDO::getId));
    }

}